<?php

namespace App\Repositories\Api;
use App\Models\Matchpool;

class MatchPoolRepository
{
    //加入或退出
    public function joinOrLogout($uid = null)
    {
        if (!intval($uid)) return false;
        $res = Matchpool::where(['uid' => $uid])->first();

        if ($res) {
            Matchpool::where("id", "=", $res['id'])->update([
                'status' => 1
            ]);
        } else {
            Matchpool::create([
                'uid' => $uid
            ]);
        }

    }

}